﻿using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using TSL_Tools.XMLTools;
using System.Xml;

namespace ReportingAppConfig
{
    public class CoreChart
    {
        #region -- Public Properties ----------------------------------------------------
        public string name { get; set; }
        public string chartTitle { get; set; }
        public string chartTemplate { get; set; }
        public string chartFormatPropertySet { get; set; }

        public List<CoreCounter> counters { get; private set; }

        #endregion

        #region -- Private Properties ---------------------------------------------------
        #endregion

        #region -- Constructors ---------------------------------------------------------
        public CoreChart() 
        {
            counters = new List<CoreCounter>();
        }
        #endregion

        #region -- Public Methods -------------------------------------------------------
        /// <summary>
        /// Used to load the config user settings into the  <see cref="AppConfiguration"/> class settings
        /// </summary>
        public void GetConfigValues(XmlNode xNode)
        {
            foreach (XmlNode xChild in xNode.SelectNodes("counter[@enabled = \"true\"]"))
            {
                CoreCounter _counter = new CoreCounter();
                _counter.GetConfigValues(xChild);
                counters.Add(_counter);
            }
        }

        /// <summary>
        /// Used to set the <see cref="AppConfiguration"/> class settings back into the config user settings file and then to save them.
        /// </summary>
        public void SaveConfigValues(XmlDocument xDoc)
        {
        }

        #endregion

        #region -- Private Methods ------------------------------------------------------
        #endregion
    }
}
